/*******************************************************************************
 ** Name: NPC.cpp                                                             **
 ** Description:                                                              **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 **  Copyright (c) 2009-2010 Barry "Gian" James  <bjames@munixos.net>         **
 **  All rights reserved.                                                     **
 **                                                                           **
 **  Redistribution and use in source and binary forms, with or without       **
 **  modification, are permitted provided that the following conditions are   **
 **  met:                                                                     **
 **                                                                           **
 **  * Redistributions of source code must retain the above copyright notice, **
 **    this list of conditions and the following disclaimer.                  **
 **  * Redistributions in binary form must reproduce the above copyright      **
 **    notice, this list of conditions and the following disclaimer in the    **
 **    documentation and/or other materials provided with the distribution.   **
 **                                                                           **
 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      **
 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED **
 ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           **
 ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT        **
 ** HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    **
 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED  **
 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR    **
 ** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    **
 ** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      **
 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        **
 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              **
 **                                                                           **
 ******************************************************************************/
// Created on April 3, 2010, 6:57 PM
// Modified $Date: 2011-09-18 21:48:59 +0000 (Sun, 18 Sep 2011) $ by $Author: gian.james $
#define  NPC_cpp_ID    "$Id: npc.cpp 145 2011-09-18 21:48:59Z gian.james $"

#include "npc.hpp"
#include "weapon.hpp"

const char * NPCTraitStr[10][100];

const char * NPCQualityTypeStr[] = {
	"All thumbs", "Alternate Identity", "Attack on command", "Augmented",
	"Burrow", "Camophlauged", "Captivating", "Carry on command", "Class ability",
	"Clumsy", "Commander", "Construct", "Damage reduction", "Damage resistance",
	"Disarm on command", "Diurnal", "Entertain on command", "Extended training",
	"Fast healing", "Fearless", "Fearsome", "Feat", "Feral", "Fleet", "Flight",
	"Foil", "Guard on command", "Henchman", "Horde", "Horrific", "Hulking",
	"Improved hearing", "Improved vision", "Improved scent", "Inferior attribute",
	"Low-light vision", "Mastermind", "Meek", "Minion", "Mount", "Natural attack",
	"Nocturnal", "Non-combatant", "Open door on command", "Prodigy", "Rescue",
	"Retrieve on command", "Seductive", "Seek on command", "Skilled", "Sluggish",
	"Specialty", "Squad item", "Squad weapon", "Stalwart", "Plot critical",
	"Strong minded", "Strong willed", "Subdue on command", "Superior attribute",
	"Talented", "Tough", "Treacherous", "Undersized", "Unnerving",
	NULL
};

const char * NPCGradeStr[] = { "I", "II", "III", "IV", "V", "VI", "VII",
		"VIII", "IX", "X", NULL
};

const char * NPCDispositionStr[] = {
		"Helpful", "Supportive", "Friendly", "Intrigued", "Neutral", "Aloof",
		"Unfriendly", "Hostile", "Adversarial", NULL
};

// TODO
int
NPCStatistics::initBonus[10][200] = {
	{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::attackBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::defenseBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::resilienceBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::dmgSaveBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::vitalityPoints[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::woundPoints[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPCStatistics::competenceBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};
int
NPCStatistics::skillBonus[10][200] = {
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  },
	{  }
};

int
NPC::accept(Pattern::Visitor * v)
{

	return 0;
}

NPC::NPC(std::string n)
    : WorldObject(OType::NPC,n)
{
	threatLevel = initGrade = attackGrade = defenseGrade = 1;
	resilienceGrade = dmgSaveGrade = vitalityGrade = 1;
	woundGrade = competenceGrade = skillGrade = 1;
	type = NPCType::Human;
	qualities = NULL;
	xp = 0;
	inventory = NULL;
//	prog = NULL;
}

NPC::NPC(const NPC& orig)
{

}

NPC::~NPC()
{
	if (qualities) {
		NPCQuality * ptr = qualities;
		qualities = qualities->next;
		delete ptr;
	}
	if (inventory)
		delete inventory;

//	if (prog)
//		delete prog;
}

/////////////////////////////////[ SignatureNPC
SignatureNPC::SignatureNPC(const std::string &n)
: NPC(n)
{
	weapon = NULL;
}

SignatureNPC::~SignatureNPC()
{
	if (weapon)
		delete weapon;
}

